<?php $__env->startSection('title'); ?><?php echo Lang::get('misc.search_users'); ?> -<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?> 
     
     <?php 
     
     $page = Input::get('page');
	 $query = Input::get('q');
	 
     // ** Admin Settings ** //
     $settings = AdminSettings::first();

		 $sql   = DB::table('members')
		 ->select(DB::raw('
		count(followers.id) totalFollowers,
		members.id,
		members.username,
		members.name,
		members.location,
		members.hire,
		members.avatar,
		members.status,
		members.type_account
		'))
		->leftjoin('followers', 'members.id', '=', DB::raw('followers.following AND followers.status = "1"'))
		->where('members.status','active')
		->where( 'members.name','LIKE', '%'.$query.'%' )
		->orWhere( 'members.username','LIKE', '%'.$query.'%' )
		->where('members.status','active')
		->groupBy('members.id')
		->orderBy('members.id', 'DESC')
		->paginate( $settings->result_request ); //$settings->result_request

		 
	 //<<---- * Total Search * ------->
	 $totalSearch = $sql->getTotal();

     ?>
     	<!-- Col MD -->
<div class="col-md-8">	
	

<h1 class="title-item none-overflow">

	<?php echo Lang::get('misc.search_users'); ?> / <?php echo e($query); ?>

	</h1>
<hr />
     
     <?php foreach( $sql as $designer ): ?>	
     
     
     	<?php echo $__env->make('includes.users-list', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
    		
    		<?php endforeach; ?>
    		
    		<?php if( $sql->count() == 0 ): ?>
    	<div class="btn-block text-center">
	    	<i class="icon-users ico-no-result"></i>
	    </div>
    		<h3 class="margin-top-none text-center no-result">
	    	- <?php echo Lang::get('users.no_members_found'); ?> -
	    	</h3>
	    	<?php endif; ?>
	    	
	    	
    		<?php if( $sql->getLastPage() > 1 && $page <= $sql->getLastPage() ): ?>

	    		<div class="btn-group paginator-style">
	        		<?php echo $sql->links(); ?> 
	        	</div>
    		
    		<?php endif; ?>
    		
 </div><!-- /COL MD -->
<?php $__env->stopSection(); ?>

<?php $__env->startSection('sidebar'); ?>
<div class="col-md-4">

<?php if( Auth::check() && Auth::user()->type_account == 2 || Auth::check() && Auth::user()->type_account == 3 ): ?>
<a class="btn btn-danger btn-lg btn-block shadow-inset col-thumb" href="<?php echo URL::to('upload'); ?>">
		<i class="glyphicon glyphicon-cloud-upload myicon-right"></i> <?php echo Lang::get('misc.upload'); ?>

		</a>
		<?php endif; ?>

		<?php echo $__env->make('includes.ads', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
          
          
          
</div><!-- /End col md-4 -->

<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>